﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true"
    CodeBehind="ServiceReportJob.aspx.cs" Inherits="SEP.Admin.ServiceReportJob" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server">    
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $("#<%=ddlPageSize.ClientID %>").change(function (e) {
                __doPostBack('<%= updatePanelJobs.ClientID %>', '');
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphTitle" runat="server">
    Active Jobs
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphBody" runat="server">
    <asp:ScriptManager ID="scriptManager1" runat="server" />
    <asp:HyperLink ID="hyperCreateJob" runat="server" Text="Create a job" NavigateUrl="~/Admin/ServiceReportJobCreator.aspx" />
    <br />
    <table align="center">
        <tr>
            <td align="left">
                <asp:DropDownList ID="ddlPageSize" runat="server">
                    <asp:ListItem Text="10" Value="10" />
                    <asp:ListItem Text="25" Value="25" />
                    <asp:ListItem Text="50" Value="50" />
                    <asp:ListItem Text="100" Value="100" />
                </asp:DropDownList>
            </td>
            <td align="right">                
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:UpdatePanel ID="updatePanelJobs" runat="server">
                    <ContentTemplate>
                        <asp:GridView ID="grvJobs" runat="server" AutoGenerateColumns="false" EmptyDataText="There aren't any jobs."
                            DataKeyNames="ID" OnRowDataBound="grvJobs_OnRowDataBound" OnRowDeleting="grvJobs_DeleteRecord"
                            PagerSettings-NextPageText="Next" PagerSettings-PreviousPageText="Previous" PagerSettings-Mode="NextPrevious"
                            AllowPaging="true" OnPageIndexChanging="grvJobs_PageIndexChanging" PagerSettings-Position="Bottom">
                            <Columns>
                                <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="~/Admin/ServiceReportJobEditor.aspx?id={0}" Text="Edit" />
                                <asp:TemplateField HeaderText="Name">
                                    <ItemTemplate>
                                        <asp:HyperLink ID="hyperlinkName" runat="server" NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "ID", "~/Admin/ServiceReportView.aspx?jobID={0}") %>'
                                            Text='<%# DataBinder.Eval(Container.DataItem, "DESCRIPTION") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField HeaderText="Date" DataField="USERDATEASSTRING" />
                                <asp:BoundField HeaderText="Service reports" DataField="NUMBEROFSERVICEREPORTS" />
                                <asp:TemplateField HeaderText="Sent to Ian">
                                    <ItemTemplate>
                                        <asp:Image ID="imgSentToIan" runat="server" ImageUrl="~/Images/check_20x15.png" Visible='<%#DataBinder.Eval(Container.DataItem, "SentToIan") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Sent to Jenny">
                                    <ItemTemplate>
                                        <asp:Image ID="imgSentToJenny" runat="server" ImageUrl="~/Images/check_20x15.png"
                                            Visible='<%#DataBinder.Eval(Container.DataItem, "SentToJenny") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("ID") %>'
                                            CommandName="Delete" Text="Delete" ForeColor="Black" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Content>
